﻿using UnityEngine;
using System.Collections;

public class BuildWindow : MonoBehaviour {

	GameObject Permit;

	void Awake(){
		Permit = Resources.Load("Prefaps/UI/Paper/BuildingPermit/BuildingPermit") as GameObject;


	}
	
	void OnEnable(){
		(Instantiate (Permit)as GameObject).transform.parent = gameObject.transform;
        transform.FindChild("BuildingPermit(Clone)").transform.localPosition = Vector3.zero;
		transform.FindChild("BuildingPermit(Clone)").transform.localScale = new Vector3 (0.9f, 1.0f);
		transform.FindChild("BuildingPermit(Clone)").GetComponent<UISprite> ().depth = GetComponent<UISprite> ().depth + 1;
	}

	void Update(){

	}

	void OnDisable(){
		transform.FindChild("BuildingPermit(Clone)").GetComponent<BuildingPermit>().DestroyThis();
	}
}
